<?php
	if($this->session->userdata("project_".$project_id)){
?>
	<div>
	
		<?php
			if($listUserShortlist->num_rows() > 0){
				foreach ($listUserShortlist->result() as $values) {
		?>
					<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 wrap_container no-padding">
						<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 no-padding">
							<a href="<?php echo site_url('programmer/viewProfile/'.$values->user_id);?>" title="<?php echo $values->user_name;?>">
								<img class="img-responsive avatar_bider" src="<?php if ($values->logo != '') echo uimage_url($values->logo); else echo image_default(); ?>">
							</a>
						</div>

						<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 no-padding">
							<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-padding" style="line-height:35px">
								<div class="user-row">
		                			<span><?php echo $values->user_name;?></span>
		                			<span style="margin-right:10px"></span>
		                			<span><?php echo getNameLocation($values->city);?></span>
		                		</div>
		                		<div class="user-row">
		                        	<div class="text-left">
		                        		<input id="preview-user" value="<?php echo $values->user_rating;?>" disabled = "disabled" type="number" data-star-captions="{}" data-default-caption="{rating}" class="rating" min=0 max=5  data-size="xs" >
		                        	</div>
		                    	</div>
		                    	<div class="user-row">
		                    		<span><?php echo $values->num_reviews;?> reviews</span>
		                    	</div>
		                    	<div class="user-row">
		                    		<span>Tỉ lệ hoàn thành</span>
		                    		<span>90%</span>
		                    	</div>
		                    	<div class="user-row">
		                    		<span>Số job dã tham gia</span>
		                    		<span><?php echo getTotalProjectUserDone($values->user_id);?></span>
		                    	</div>
							</div>
						</div>

						<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 no-padding info-user-footer3">
							<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
								<div class="user-row" style="margin-top:5px">
		                			<span><?php echo count_days_before($values->bid_time,time());?></span>
		                		</div>
		                		<div class="user-row" style="min-height:95px;margin-top:10px">
		                			<span>
		                				<?php 
			                				if(strlen($values->bid_desc) > 100) 
		                						echo cutStringDes($values->bid_desc,170)."...<a class='see_more' data-content= '".$values->bid_desc."' >More</a>";
		                					else
		                						echo $values->bid_desc;
		                				?>
		                			</span>
		                		</div>
		                		<div class="user-row">
		                			<span>
		                				<button class="btn btn-md btn-message" data-toggle="tooltip"
   													data-placement="top" title="Chức năng đang hoàn thiện">Message</button>
		                			</span>
		                		</div>
							</div>
						</div>

						<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"  style="line-height:40px">
							<div class="user-row about_employer">
			        			<span><?php echo '$'.$values->bid_amount;?></span>
			        		</div>
			        		<div class="user-row about_employer">
			        			<span><?php echo $values->bid_days;?></span>
			        			<span> days</span>
			        		</div>
			        		<div class="user-row">
			        			<label>
			        				<!-- <a name="remove_shortlist" class="remove_shortlist mauchu" data-pr-id = "<?php echo $values->project_id;?>" data-user-id = "<?php echo $values->user_id;?>">Remove</a> -->
			        				<a name="remove_shortlist" class="mauchu" data-pr-id = "<?php echo $values->project_id;?>" data-user-id = "<?php echo $values->user_id;?>">Remove</a>
			        			</label>
			        		</div>
		        			
			        		<div class="user-row">
			        			<button type="button" class="btn btn-md btn_invite_dev btn-message" id="btn_invite_dev" data-href="<?php echo site_url("userList/inviteProgrammer/".$values->user_id)?>">Hire</button>			        			
			        		</div>
						</div>
				    </div>
		<?php
				}
			}
		?>	   
    		
	
</div>


<?php
	}else{
		echo "Chưa có danh sách Shortlist";
	}

?>
<script>
    $(document).ready(function(){
        $(".rating").rating('refresh',{showCaption:true,clearCaption:'0'});
        $(function () { $("[data-toggle='tooltip']").tooltip(); });
        $('.btn_invite_dev').on('click', function () {
	        var url = $(this).attr('data-href');
	        $.get(url, function (data) {
	            $('#ajax-modal2').html(data);
	            $('#ajax-modal2').modal();
	        });
	    });
	    $("a.see_more").popover({
	        title : 'Description',
	        placement : 'top'
	    });

	    $(".remove_shortlist").on("click",function(e){
	    	var user_id = $(this).attr('data-user-id');
			var pr_id = $(this).attr('data-pr-id');
			var url = "<?php echo site_url('project/shortlist');?>";
			var target = $(this).parent();
			$.ajax({
				type : "POST",
				url : url,
				data : ({pr_id : pr_id,user_id : user_id,flag: 0}),
				beforeSend : function(){
					//target.hide();
				},
				success: function(data){
					var res = $.parseJSON(data);
					if(res.status == "success"){
						target.removeClass("mauchu");
						$("#shortlist").load("<?php echo base_url().'index.php/project/show_shortlist_tab/'.$project_id?>");
						//alert("Đã được chọn vào danh sách");
					}
				},
			})// end ajax
	    });

	     $("body").on('click','a.see_more',function(){
	    	var content = $(this).attr('data-content');
	    	$(this).parent().html(content);
	    })
    });
</script>